package com.xihuanjun.sdk.entity;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.xihuanjun.sdk.enums.YNEnum;
import lombok.Data;
import lombok.ToString;

/**
 * Copyright (C), 2024-08-27
 * FileName: SapItem
 * Author:   溪浣君
 * Date:     2024-08-27 16:50
 * Description:
 */
@Data
@ToString
@JsonAutoDetect(fieldVisibility= JsonAutoDetect.Visibility.ANY,getterVisibility= JsonAutoDetect.Visibility.NONE)
public class SapItem extends BaseEntity {



    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String ItemName;


    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String ForeignName;


    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer ItemsGroupCode;


    /**
     * 销售物料
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private YNEnum SalesItem;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private YNEnum PurchaseItem;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private YNEnum InventoryItem;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private YNEnum Valid;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private  String ValidRemarks;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private YNEnum Frozen;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String FrozenRemarks;

    /**
     * 设置可用状态
     * @param isValid true可用，false不可用
     * @param remark 备注
     */
    protected void setValidStatus(boolean isValid,String remark){
        if(isValid){
            this.setValid(YNEnum.tYES);
            this.setFrozen(YNEnum.tNO);
            this.setValidRemarks(remark);
        }else{
            this.setValid(YNEnum.tNO);
            this.setFrozen(YNEnum.tYES);
            this.setFrozenRemarks(remark);
        }
    }
}